import request from '../utils/request'

/*获取用户列表*/
export function getUsers(params){
  return request({
    method:'get',
    url:'users',
    params
  })
}

/*修改用户状态*/
export function updateUserState(params){
  const {uId,type} = params
  return request({
    method:'put',
    url:`users/${uId}/state/${type}`
  })
}

/*添加用户*/
export function addUser(data){
  return request({
    method:'post',
    url:'users',
    data
  })
}
/*编辑用户提交*/
export function updateUser(id,data){
  return request({
    method:'put',
    url:'users/'+id,
    data
  })
} 


/*删除用户*/
export function deleteUser(id){
  return request({
    method:'delete',
    url:'users/'+id
  })
} 

/*分配用户角色 */
export function updateUserRole(id,data){
  return request({
    method:'put',
    url:`users/${id}/role`,
    data
  })
}